package com.boot.business.demo.mdao;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import com.boot.business.demo.entity.User;

@Mapper //1
public interface MUserDao {
    @Results({ //2
            @Result(property = "id", column = "telephone"), //2
            @Result(property = "username", column = "username"),
            @Result(property = "telephone", column = "telephone")
    })
    @Select("SELECT * FROM sec_user WHERE telephone = #{phone}") //3
    List<User> get(String phone);

    @Insert("INSERT INTO sec_user(username, telephone) VALUES (#{username}, #{telephone})") //3
    void insert(User user);
}